//#include "../include/N_arytree.h"
//#include "../include/BST.h"
//#include "../include/hashTable.h"

#define ERR_VFS_MOVEFILE_01 "CANNOT_FIND_SPECIFIED_SOURCEFILE"
#define ERR_VFS_MOVEFILE_02 "CANNOT_FIND_SPECIFIED_DESTINATIONFILE"
#define ERR_VFS_MOVEFILE_03 "SOURCE_PATH_MISSING"
#define ERR_VFS_MOVEFILE_04 "DESTINATION_PATH_MISSING"

void move_file(char *source_file_path,char *dest_file_path) 
{
	char *path;
	if(source_file_path==NULL)
	{
		printf("%s\n",ERR_VFS_MOVEDIR_03);
		return;
	}
	
	if(dest_file_path==NULL)
	{
		printf("%s\n",ERR_VFS_MOVEDIR_04);
		return;
	}
	
	path=parsePath(source_file_path);
	fd * source=returnnode(&naryRoot,path);
	if(source==NULL)
	{
		printf("%s\n",ERR_VFS_MOVEFILE_01);
		return;
	}
	
	fd *dest=bstSearchNode(&bstRoot,dest_file_path);
	if(dest==NULL)
	{
		printf("%s\n",ERR_VFS_MOVEFILE_02);
		return;
	}
	
	fd *new=(fd*) malloc(sizeof(fd));

	new->file_name=source->file_name;
	strcpy(new->path,path);
	new->blockNum=source->blockNum;
	new->fileType=source->fileType;
	new->fileSize=source->fileSize; 
	 
	delete_node(&naryRoot,path);
	insert_node(&naryRoot,new);
	
	fd newHash=*new;
	updateHashFileDesc(hash,newHash,path);
	
	
}
